package uk.ac.aber.Blockmation.Actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import uk.ac.aber.Blockmation.MainFrame;


/**
 * 
 * @author tom, alex
 */

public class ActionInsertFrame extends AbstractAction {
	
    private MainFrame mainFrame;
    private String path = "../icons/AddNewFrame.gif";

    public ActionInsertFrame (MainFrame mainFrame) {
        super("Insert New Frame"); 
        this.mainFrame = mainFrame;
        
        // the below from settings class file or?!
        //putValue(SHORT_DESCRIPTION, tooltip);  // Will appear as tooltip text.
        //putValue(MNEMONIC_KEY, new Integer(mnemonic));
        
    }
        
    public void actionPerformed(ActionEvent e) {
        int index = mainFrame.getCurrentFrameIndex();
        
    	mainFrame.getMovieModel().appendFrame( mainFrame.getMovieModel().get(index) );

        index++;
        mainFrame.setCurrentFrameIndex(index);
        
        mainFrame.getPad().setImage( mainFrame.getMovieModel().get(index) );
        
        mainFrame.getNavigationBar().setValue(index);
    }
    
    public void setImage () {
        CreateImageIcon createImageIcon = new CreateImageIcon();
        putValue(SMALL_ICON, createImageIcon.create(path));
    }


}
